package com.dnjn.happiness.biz.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dnjn.happiness.biz.domain.TrainingRecord;
import com.dnjn.happiness.biz.domain.TrainingUserVO;
import com.dnjn.happiness.system.api.domain.SysUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 培训签到记录Mapper接口
 *
 * @author happiness
 * @date 2023-10-17
 */
public interface TrainingRecordMapper extends BaseMapper<TrainingRecord> {
    @Select("SELECT re.user_id FROM `biz_training` tr LEFT JOIN biz_training_record re ON tr.training_id = re.training_id  where re.training_id =#{traingId}")
    List<String> selectUserListBytraingId(@Param("traingId") Long traingId);

    List<SysUser> forTrainingDetailsSeeFeedback(Long trainingId);

    List<TrainingRecord> forTrainingDetailsSeeFeedbackByTrainingIdAndLeaderId(@Param("trainingId") Long trainingId, @Param("leaderId") Long leaderId);

    List<TrainingUserVO> screeningTrainingSubmit(@Param("trainingId") Long trainingId, @Param("deptId") Long deptId, @Param("nickNmae") String nickName);

    Page<TrainingRecord> goToTheTrainingDetailsView(Page<TrainingRecord> page, @Param("status") String status, @Param("trainingId") Long trainingId);

    @Select("SELECT * FROM biz_training_record WHERE training_id = #{trainingId} AND result IS NOT NULL")
    List<TrainingRecord> getResultListByTrainingId(String trainingId);

    List<TrainingRecord> selectRecordsByTrainingId(String trainingId);

//    @Select("select x.image_url from biz_moments_image i left join biz_image x on i.image_id =x.image_id where i.moments_id =#{momentsId}")
//    List<String> selectImageUrlByMomentsId(@Param("momentsId") Long momentsId);
}
